Urban Resilience: Tirana, a Case Study [Part 1]

Hello and welcome!
Set-up and Intro
I have been thinking about different issues in urban planning for quite a while, and one main question that has piqued my interest is: "what makes a city resilient?" Why do some cities manage to withstand and overcome different challenges whereas others struggle with them a lot more? Or why are there hyperlocal differences (e.g. between neighborhoods) in a city's resilience efforts? This multi-part story is an exploration of urban resilience in the context of Tirana, the capital of Albania.
There have been many candidate answers to this question: the CDC uses the Social Vulnerability Index (SVI) to measure a census tract's vulnerability to challenges, both human-made and natural. SVI includes factors like poverty, lack of vehicle access and crowded housing to produce a final ranking for a particular tract. This index can be used to address issues like "deciding how many emergency personnel are required to assist people" and to "identify areas in need of emergency shelters".
In this story, I want to not exclusively focus on the "disaster management" aspect of resilience. Rather, let's consider resilience as per the OECD definition: Resilient cities are cities that have the ability to absorb, recover and prepare for future shocks (economic, environmental, social & institutional). For Tirana, in particular, it's important to understand resilience in the context of population change and the rapid urbanization that took place starting from the 1990s. Rapid urbanization can put a lot of pressure in a city's land and service resources, and resilient cities are those that ensure their residents have equitable access to them. How have these dynamics developed over the past 30 or so years?
For this story I'll use population count data from the City of Tirana Open Data Portal (data + license: Creative Commons Attribution) and packages like PySAL for spatial analysis and seaborn and pandas for data visualization. Let's get started!
Power Law
Urban planners have tried to capture the idea of a resilient city by looking at urban form. One major instance of this is scale hierarchy or power laws. A power law is a relationship between x and y that can be modeled using this formula and shape:

It turns out a lot of relationships can be described using power laws: frequencies of last names (a few names are very popular so they show up with really high frequency), energy consumption (a few geographical areas consume the majority of the energy). In urban planning in particular, scale hierarchy/power laws turn up in the distribution of subway stations, residential densities, and even job counts.
Visualizing the Data
Let's take a look at Tirana's population distribution over data for 3 years: 2009, 2015, and 2021:

It seems these counts deviate slightly from a power law, at least qualitatively. There also are more tests to conduct to test for a power law, such as the Kolmogorov-Smirnov. However we would need to make a series of assumptions to actually carry those out (like the values being independent of each-other). For now, let's take a closer look at some of these neighborhoods.
What might be some of the reasons behind some of the deviations? There can be many: sudden growth of certain areas, outward migration, movement within neighborhoods etc. Here is a map of the populations for each of Tirana's 24 areas across the years 2009–2020:

Note the gradual increases in periurban areas: during the period after the fall of Communism, a lot of people moved into the areas bordering Tirana, often building their homes in the old expropriated land, eventually becoming a key part of the economical life of Tirana (more on this here).
How about the core 11 areas that make up urban Tirana? Here is the filtered out map:

Spatial Markov Movels
To analyze these population counts dynamics more in-depth, we have to build models that express behavior through time. Markov models come in handy for this, allowing us to model transition and stationary probabilities for discrete states. In this set-up, we can specify 4 (customizable) buckets for the population counts of the areas: